import type { IMenuItem, IMenuList, IUserInfo } from '@/types'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useUserStore = defineStore('user', () => {
  const userInfo = ref({})
  const menuList = ref<IMenuItem[]>([])

  const changeUserInfo = (data: IUserInfo) => {
    userInfo.value = data
  }

  const changeMenuList = (data: IMenuList) => {
    menuList.value = data.menuList
  }

  return {
    userInfo,
    changeUserInfo,
    menuList,
    changeMenuList
  }
})
